]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st: Only use clutter_actor_invalidate_paint_volume() if the API exists
authorJonas Dreßler <verdre@v0yd.nl>
Mon, 12 Apr 2021 18:49:10 +0000 (20:49 +0200)
committerMarge Bot <marge-bot@gnome.org>
Mon, 26 Apr 2021 12:18:52 +0000 (12:18 +0000)
With commits fab39bbea5d9a7a0330a1be548f8ee26cd7e3131 and
62e40a13506b4481a50944be886b36566c464dc0 we started depending on a new
ClutterActor API: clutter_actor_invalidate_paint_volume()

Given that this commit was applied to the 40 stable release, it broke
ABI compatibility with mutter, which is something we guarantee between
stable releases. So use GModule to dynamically find the symbol in our
loaded libraries. If it exists, use it and invalidate the paint volume.
If it doesn't exist, libmutter is still at version 40.0 and we don't
need to invalidate the paint volume.

This also adds a dependency on gmodule. We need to link against gmodule
to use g_module_open() and g_module_symbol() APIs.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1807>

meson.build
src/st/meson.build
src/st/st-viewport.c
src/st/st-widget.c

index 14b75c1c9f5b662f813da3fd508839426ef21138..359fa2a35d30dd0a88d54100c65619f619d59122 100644 (file)
@@ -81,6 +81,7 @@ gi_dep = dependency('gobject-introspection-1.0', version: gi_req)
 gio_dep = dependency('gio-2.0', version: gio_req)
 gio_unix_dep = dependency('gio-unix-2.0', version: gio_req)
 gjs_dep = dependency('gjs-1.0', version: gjs_req)
+gmodule_dep = dependency('gmodule-2.0')
 gtk_dep = dependency('gtk+-3.0', version: gtk_req)
 libxml_dep = dependency('libxml-2.0')
 clutter_dep = dependency(clutter_pc, version: mutter_req)
index 6b88af295205690bf34b897d7a89a71f41d63f7d..a74581ff8a58ad9f09bf012a3be886507d1163c3 100644 (file)
@@ -180,7 +180,7 @@ st_cflags = [
 libst = shared_library('st-1.0',
   sources: st_gir_sources + st_nogir_sources + croco_sources,
   c_args: st_cflags,
-  dependencies: [clutter_dep, gtk_dep, mutter_dep, libxml_dep, m_dep],
+  dependencies: [clutter_dep, gmodule_dep, gtk_dep, mutter_dep, libxml_dep, m_dep],
   build_rpath: mutter_typelibdir,
   install_rpath: mutter_typelibdir,
   install_dir: pkglibdir,
index 96b703b14feaa985043d172a4b5915551be9e0bf..8aaaad54acf06bd2501b43808c696723a91f821b 100644 (file)
@@ -80,8 +80,22 @@ adjustment_value_notify_cb (StAdjustment *adjustment,
                             GParamSpec   *pspec,
                             StViewport   *viewport)
 {
+  static gboolean invalidate_paint_volume_valid = FALSE;
+  static void (* invalidate_paint_volume) (ClutterActor *) = NULL;
+
   clutter_actor_invalidate_transform (CLUTTER_ACTOR (viewport));
-  clutter_actor_invalidate_paint_volume (CLUTTER_ACTOR (viewport));
+
+  if (!invalidate_paint_volume_valid)
+    {
+      g_module_symbol (g_module_open (NULL, G_MODULE_BIND_LAZY),
+                       "clutter_actor_invalidate_paint_volume",
+                       (gpointer *)&invalidate_paint_volume);
+      invalidate_paint_volume_valid = TRUE;
+    }
+
+  if (invalidate_paint_volume)
+    invalidate_paint_volume (CLUTTER_ACTOR (viewport));
+
   clutter_actor_queue_relayout (CLUTTER_ACTOR (viewport));
 }
 
index 47a84c5c2de11668da28d00d464e6db9a38bacf0..05a2dd134b0f67112286804db146ca62818702bf 100644 (file)
@@ -1722,7 +1722,19 @@ st_widget_recompute_style (StWidget    *widget,
 
   if (!paint_equal)
     {
-      clutter_actor_invalidate_paint_volume (CLUTTER_ACTOR (widget));
+      static gboolean invalidate_paint_volume_valid = FALSE;
+      static void (* invalidate_paint_volume) (ClutterActor *) = NULL;
+
+      if (!invalidate_paint_volume_valid)
+        {
+          g_module_symbol (g_module_open (NULL, G_MODULE_BIND_LAZY),
+                           "clutter_actor_invalidate_paint_volume",
+                           (gpointer *)&invalidate_paint_volume);
+          invalidate_paint_volume_valid = TRUE;
+        }
+
+      if (invalidate_paint_volume)
+        invalidate_paint_volume (CLUTTER_ACTOR (widget));
 
       next_paint_state (widget);